package com.gs.weather.dao;

import com.gs.weather.dao.mapper.ViewWidgetMapper;
import com.gs.weather.vo.LinkageFrameVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Legolas
 * Date: 2017/10/16 0016
 */
@Repository
public class ViewWidgetDao {
    Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    ViewWidgetMapper mapper;

    //联动框取所有类型名
   public List<LinkageFrameVO> queryAllTypeName(){
        try {
            return mapper.queryAllTypeName();
        } catch (Exception e) {
            logger.info("queryAllTypeName->{}", e.getMessage());
            return null;
        }
    }

    //联动框取子类型名
   public List<LinkageFrameVO> queryAllSubtypeNameByTypeId(int id){
        try {
            return mapper.queryAllSubtypeNameByTypeId(id);
        } catch (Exception e) {
            logger.info("queryAllSubtypeNameByTypeId->{}", e.getMessage());
            return null;
        }
    }

    //联动框取强度
   public List<LinkageFrameVO> queryAllStrengthLevelBySubtypeId(int id){
        try {
            return mapper.queryAllStrengthLevelBySubtypeId(id);
        } catch (Exception e) {
            logger.info("queryAllStrengthLevelBySubtypeId->{}", e.getMessage());
            return null;
        }
    }
}
